'use strict';

function get_letter_interval_2(number_a, number_b) {
  //在这里写入代码
  return two_numTurnArray(number_a,number_b).map(num_turn_letter) ;
}

module.exports = get_letter_interval_2;

function two_numTurnArray(number_a,number_b){ 
  let arr1 = [] ;
  //不相等
  if(number_a > number_b){
    for(let value = number_a ;value >= number_b ; value --){
      arr1.push(value) ;
    }
  }
  if(number_a < number_b){
    for(let value = number_a ;value <= number_b ; value ++){
      arr1.push(value) ;
    }
  }
  //相等情况
  if ((number_a === number_b)) {
      arr1.push(number_a) ;
    }
    return arr1 ;
}
// console.log(two_numTurnArray(1,26).map((x)=>(String.fromCharCode(x+96)))) ;

function num_turn_letter(num){ 
  let str = '' ;
  if(num <= 26){
    if(num === 0){
      num += 26 ;
    }
     str = String.fromCharCode(num+96) ;
     return str ;
  }else if(num%26 === 0){
    str = String.fromCharCode(Math.floor(num/26)+95) ;
    return str + num_turn_letter(num%26) ;
  }else{
    str = String.fromCharCode(Math.floor(num/26) +96) ;
    return str + num_turn_letter(num%26) ;
  }
}
// console.log(num_turn_letter(52));
